import 'package:json_annotation/json_annotation.dart';

part 'response_entity.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class ResponseEntity<T> {
  @JsonKey(includeIfNull: false)
  final T? data;

  int? statusCode;
  String? statusMessage;

  ResponseEntity({
    this.data,
    this.statusCode,
    this.statusMessage,
  });

  factory ResponseEntity.fromJson(
    Map<String, dynamic> json,
    T Function(Object? json) fromJsonT,
  ) =>
      _$ResponseEntityFromJson(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$ResponseEntityToJson(this, toJsonT);
}
